package ex55.mm.flow.impound.quote.exchange.api;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.joda.time.DateTime;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public class MarketDataDepth {
    public static class Entry {
        private BigDecimal price;
        private BigDecimal quantity;

        public BigDecimal getPrice() {
            return price;
        }

        public Entry setPrice(BigDecimal price) {
            this.price = price;
            return this;
        }

        public BigDecimal getQuantity() {
            return quantity;
        }

        public Entry setQuantity(BigDecimal quantity) {
            this.quantity = quantity;
            return this;
        }

        @Override
        public String toString() {
            return ToStringBuilder.reflectionToString(this);
        }
    }

    private Product product;

    private List<Entry> asks;
    private List<Entry> bids;

    private Date updatedAt;
    private Date refreshedAt;

    public Product getProduct() {
        return product;
    }

    public MarketDataDepth() {
        this.refreshedAt = DateTime.now().toDate();
    }

    public MarketDataDepth setProduct(Product product) {
        this.product = product;
        return this;
    }

    public List<Entry> getAsks() {
        return asks;
    }

    public MarketDataDepth setAsks(List<Entry> asks) {
        this.asks = asks;
        return this;
    }

    public List<Entry> getBids() {
        return bids;
    }

    public MarketDataDepth setBids(List<Entry> bids) {
        this.bids = bids;
        return this;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public MarketDataDepth setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
        return this;
    }

    public Date getRefreshedAt() {
        return refreshedAt;
    }

    public MarketDataDepth setRefreshedAt(Date refreshedAt) {
        this.refreshedAt = refreshedAt;
        return this;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
